﻿@page "/dashboard"
@attribute [MustHavePermission(FSHAction.View, FSHResource.Dashboard)]

@inject IStringLocalizer<Dashboard> L

<FshTitle Title="@L["Dashboard"]" Description="@L["Realtime Updates & Insights with SignalR."]" />

@if (!_loaded)
{
    <MudProgressCircular Color="Color.Primary" Indeterminate="true" />
}
else
{
    <MudGrid>
        <MudItem xs="12" sm="6" md="3">
            <MudPaper Elevation="25" Class="d-flex flex-row pt-6 pb-4" Style="height:100px;">
                <MudIcon Icon="@Icons.Material.Filled.ViewCarousel" Color="Color.Primary" Class="mx-4"
                Style="width:54px; height:54px;"></MudIcon>
                <div>
                    <MudText Typo="Typo.subtitle1" Class="mud-text-secondary mb-n1">@L["Products"]</MudText>
                    <MudText Typo="Typo.h5">@ProductCount</MudText>
                </div>
            </MudPaper>
        </MudItem>
        <MudItem xs="12" sm="6" md="3">
            <MudPaper Elevation="25" Class="d-flex flex-row pt-6 pb-4" Style="height:100px;">
                <MudIcon Icon="@Icons.Material.Filled.PanoramaPhotosphereSelect" Color="Color.Secondary" Class="mx-4"
                Style="width:54px; height:54px;"></MudIcon>
                <div>
                    <MudText Typo="Typo.subtitle1" Class="mud-text-secondary mb-n1">@L["Brands"]</MudText>
                    <MudText @bind-Value="@BrandCount" Typo="Typo.h5">@BrandCount</MudText>
                </div>
            </MudPaper>
        </MudItem>
        <MudItem xs="12" sm="6" md="3">
            <MudPaper Elevation="25" Class="d-flex flex-row pt-6 pb-4" Style="height:100px;">
                <MudIcon Icon="@Icons.Material.Filled.Face" Color="Color.Success" Class="mx-4"
                Style="width:54px; height:54px;"></MudIcon>
                <div>
                    <MudText Typo="Typo.subtitle1" Class="mud-text-secondary mb-n1">@L["Registered Users"]
                    </MudText>
                    <MudText Typo="Typo.h5">@UserCount</MudText>
                </div>
            </MudPaper>
        </MudItem>
        <MudItem xs="12" sm="6" md="3">
            <MudPaper Elevation="25" Class="d-flex flex-row pt-6 pb-4" Style="height:100px;">
                <MudIcon Icon="@Icons.Material.Filled.Groups" Color="Color.Warning" Class="mx-4"
                Style="width:54px; height:54px;"></MudIcon>
                <div>
                    <MudText Typo="Typo.subtitle1" Class="mud-text-secondary mb-n1">@L["Registered Roles"]
                    </MudText>
                    <MudText Typo="Typo.h5">@RoleCount</MudText>
                </div>
            </MudPaper>
        </MudItem>
        <MudItem xs="12" sm="12">
            <MudPaper Elevation="25" Class="pa-4" Style="height:500px;">
                <MudChart ChartType="ChartType.Bar" ChartSeries="@_dataEnterBarChartSeries"
                XAxisLabels="@_dataEnterBarChartXAxisLabels.Select(a => L[a].Value).ToArray()" Width="100%"
                Height="400px"></MudChart>
            </MudPaper>
        </MudItem>
    </MudGrid>
}